import $app from '../$app';


export default {
	//办登通知书
	his_list(state, note) {
		let his_list = [];

		// 有通知书对象 下面的东西，无需判断状态，只要有值，就显示
		if ($app.judgeData(note)) {

			// 状态16 已下证
			if ($app.package_file_url(note.certificate_note_path)) {
				his_list.push({
					state_name: '专利已下证',
					note_date: note.certificate_note_date,
					book: [{
						name: '下证通知书',
						url: $app.getVal_fileUrl( note.certificate_note_path )
					}]
				});
			}

			//131
			if ($app.package_file_url(note.publish_note_file)) {
				his_list.push({
					state_name: '发明公布通知书',
					note_date: note.publish_note_date,
					book: [{
						name: '发明公布通知书',
						url: $app.getVal_fileUrl( note.publish_note_file )
					}]
				});
			}

			//22
			if ($app.package_file_url(note.treat_not_submit_note_path)) {
				his_list.push({
					state_name: '视为未提出通知书',
					note_date: note.treat_not_submit_note_date,
					book: [{
						name: '视为未提出通知书',
						url: $app.getVal_fileUrl( note.treat_not_submit_note_path )
					}]
				});
			}

			//23
			if ($app.package_file_url(note.treat_not_submit_division_note_path)) {
				his_list.push({
					state_name: '分案申请视为未提出通知书',
					note_date: note.treat_not_submit_division_note_date,
					book: [{
						name: '分案申请视为未提出通知书',
						url: $app.getVal_fileUrl( note.treat_not_submit_division_note_path )
					}]
				});
			}



			// 状态20 
			if ($app.package_file_url(note.treat_abandoned_note_path)) {
				his_list.push({
					state_name: '视为放弃取得专利权',
					note_date: note.treat_abandoned_note_date,
					book: [{
						name: '视为放弃取得专利权通知书',
						url: $app.getVal_fileUrl( note.treat_abandoned_note_path )
					}]
				});
			}

			// 21 
			if ($app.package_file_url(note.treat_withdraw_note_path)) {
				his_list.push({
					state_name: '视为撤回',
					note_date: note.treat_withdraw_note_date,
					book: [{
						name: '视为撤回通知书',
						url: $app.getVal_fileUrl( note.treat_withdraw_note_path )
					}]
				});
			}



			// 18
			if ($app.package_file_url(note.withdraw_note_path)) {
				his_list.push({
					state_name: '专利被撤回',
					note_date: note.withdraw_note_date,
					book: [{
						name: '撤回通知书',
						url: $app.getVal_fileUrl( note.withdraw_note_path )
					}]
				});
			}



			//17
			if ($app.package_file_url(note.reject_note_path)) {
				his_list.push({
					state_name: '专利被驳回',
					note_date: note.reject_note_date,
					book: [{
						name: '驳回通知书',
						url: $app.getVal_fileUrl( note.reject_note_path )
					}]
				});
			}


			// 5待缴申请费
			if ($app.package_file_url(note.accept_note_path) || $app.package_file_url(note.demand_note_path)) { 
				let book=[];
				if($app.package_file_url(note.accept_note_path)){
					book.push({
						name: '受理通知书',
						url: $app.getVal_fileUrl( note.accept_note_path )
					});
				}
				if($app.package_file_url(note.demand_note_path)){
					book.push({
						name: '缴费通知书',
						url: $app.getVal_fileUrl( note.demand_note_path )
					});
				}
				his_list.push({
					state_name: '专利已受理',
					note_date: note.demand_note_date, //创建日期
					book
				});
			}

			// 61
			if ($app.package_file_url(note.first_inspe_note_files)) {
				his_list.push({
					state_name: '初审合格',
					note_date: note.first_inspe_note_date,
					book: [{
						name: '发明专利初审合格通知书',
						url: $app.getVal_fileUrl( note.first_inspe_note_files )
					}]
				});
			}

			// 13
			if ($app.package_file_url(note.final_inspe_note_files)) {
				his_list.push({
					state_name: '实质审查中',
					note_date: note.final_inspe_note_date,
					book: [{
						name: '发明专利申请公布及进入实质审查阶段通知书',
						url: $app.getVal_fileUrl( note.final_inspe_note_files )
					}]
				});
			}

			// 14
			if ($app.package_file_url(note.auth_note_path) || $app.package_file_url(note.dealt_register_note_path)) { 
				let book=[];
				if($app.package_file_url(note.auth_note_path)){
					book.push({
						name: '授权通知书',
						url: $app.getVal_fileUrl( note.auth_note_path )
					});
				}
				if($app.package_file_url(note.dealt_register_note_path)){
					book.push({
						name: '办理登记通知书',
						url: $app.getVal_fileUrl( note.dealt_register_note_path )
					});
				}
				his_list.push({
					state_name: '专利已登记',
					note_date: note.dealt_register_date,
					book
				});
			}


			//以下的通知书，和状态没关系，只要有，就显示
			if ($app.package_file_url(note.cost_reduction_note_path)) {
				his_list.push({
					state_name: '费减通知书',
					note_date: note.cost_reduction_note_date,
					book: [{
						name: '费减通知书',
						url: $app.getVal_fileUrl( note.cost_reduction_note_path )
					}]
				});
			}

			if ($app.package_file_url(note.auth_change_note_path)) {
				his_list.push({
					state_name: '授权更正通知书',
					note_date: note.auth_change_note_date,
					book: [{
						name: '授权更正通知书',
						url: $app.getVal_fileUrl( note.auth_change_note_path )
					}]
				});
			}

			if ($app.package_file_url(note.apply_date_change_note_path)) {
				his_list.push({
					state_name: '重新确定申请日通知书',
					note_date: note.apply_date_change_note_date,
					book: [{
						name: '重新确定申请日通知书',
						url: $app.getVal_fileUrl( note.apply_date_change_note_path )
					}]
				});
			}

			if ($app.package_file_url(note.fee_note_path)) {
				his_list.push({
					state_name: '缴费通知书(年费)',
					note_date: note.fee_note_date,
					book: [{
						name: '缴费通知书(年费)',
						url: $app.getVal_fileUrl( note.fee_note_path )
					}]
				});
			}



		}

		return his_list;

	},


	//缴费记录
	his_pay(orderInfo) {
		let his_pay = [];

		let {
			apply_pay_type,
			auth_pay_type
		} = orderInfo;



		//申请费 0未缴费，1余额支付,2自行缴费
		if (apply_pay_type > 0) {
			let text = '';
			switch (parseInt(apply_pay_type)) {
				case 1:
					text = '系统代缴';
					break;
				case 2:
					text = '自行缴费';
					break;
			}

			his_pay.push({
				type: 1,
				a1: '申请费',
				a3: orderInfo.apply_fee_pay_time, //缴费时间
				a4: text,
				auth_money: parseFloat(orderInfo.apply_money),
				official: parseFloat(orderInfo.apply_official_fee),
				service: parseFloat(orderInfo.apply_service_fee)
			})
		}

		//办理登记费 0未缴费，1余额支付,2自行缴费
		if (auth_pay_type > 0) {
			let text = '';
			switch (parseInt(auth_pay_type)) {
				case 1:
					text = '系统代缴';
					break;
				case 2:
					text = '自行缴费';
					break;
			}

			
			his_pay.push({
				type: 2,
				a1: '办理登记费',
				a3: orderInfo.auth_pay_time, //缴费时间
				a4: text,
				auth_money: parseFloat(orderInfo.auth_money),
				official: parseFloat(orderInfo.auth_year_fee),
				service: parseFloat(orderInfo.auth_service_fee),
				yinHua: parseFloat(orderInfo.auth_stamp_duty_fee)
			})
		}

		return his_pay;
	},
};
